package com.bupt.inklue.controller;

import com.bupt.inklue.dto.HanZiDTO;
import com.bupt.inklue.service.HanZiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("han_zi")
public class HanZiController {

    @Autowired
    private HanZiService hanZiService;

    @GetMapping("{code}")
    public HanZiDTO getByCode(@PathVariable String code) {
        return hanZiService.getByCode(code);
    }

    @GetMapping
    public List<HanZiDTO> getAll() {
        return hanZiService.getAll();
    }
}
